Micron Document
🎖️GitЯра🎖️

Commit 74dfd43ec2c13af9feb9b6c5fccf55977d83adb1


Parents : 0c21e98
Author : James Rich <james.a.rich@gmail.com>
Date : 2026-07-14T18:44:42-05:00

fix(connections): show device long names in the connection manager (#5808)

The BLE advertisement only carries a device's short name (e.g.
Meshtastic_ab12), so users with several similarly-named devices could
not tell them apart in the picker. For devices we've connected to
before we already hold the unique long name (node.user.long_name), but
the row rendered only a tiny short-name NodeChip and dropped it.

Render the NodeChip alongside the long name for known nodes, and let
the name wrap to two lines instead of truncating at one, so long
advertised names stay legible too.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>

Changes
Diff

diff --git a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/component/ConnectionsPreviews.kt b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/component/ConnectionsPreviews.kt
index bb2e9576ca..dc3a0ada77 100644
--- a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/component/ConnectionsPreviews.kt
+++ b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/component/ConnectionsPreviews.kt
@@ -30,6 +30,7 @@ import org.meshtastic.core.ble.BleConnectionState
import org.meshtastic.core.ble.BleDevice
import org.meshtastic.core.model.ConnectionState
import org.meshtastic.core.model.DeviceType
+import org.meshtastic.core.model.Node
import org.meshtastic.core.ui.icon.MeshtasticIcons
import org.meshtastic.core.ui.icon.Search
import org.meshtastic.core.ui.theme.AppTheme
@@ -43,6 +44,7 @@ import org.meshtastic.feature.connections.ui.components.DeviceSectionHeader
import org.meshtastic.feature.connections.ui.components.DisconnectButton
import org.meshtastic.feature.connections.ui.components.EmptyStateContent
import org.meshtastic.feature.connections.ui.components.TransportSelector
+import org.meshtastic.proto.User
private const val PREVIEW_BLE_RSSI = -60
@@ -53,6 +55,16 @@ fun DeviceListItemPreview() {
AppTheme { DeviceListItem(connectionState = ConnectionState.Disconnected, device = device, onSelect = {}) }
}
+// Previously-connected device: shows the short-name NodeChip alongside the unique long name (#5808), which wraps to a
+// second line rather than truncating.
+@PreviewLightDark
+@Composable
+private fun DeviceListItemWithLongNamePreview() {
+ val node = Node(num = 13444, user = User(short_name = "AB12", long_name = "James' Rooftop Solar Repeater"))
+ val device = DeviceListEntry.Tcp(name = "Meshtastic_ab12", fullAddress = "s192.168.1.101", node = node)
+ AppTheme { DeviceListItem(connectionState = ConnectionState.Disconnected, device = device, onSelect = {}) }
+}
+
@PreviewLightDark
@Composable
fun DisconnectButtonPreview() {

diff --git a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DeviceListItem.kt b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DeviceListItem.kt
index 58332dbc61..91db062fc8 100644
--- a/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DeviceListItem.kt
+++ b/feature/connections/src/commonMain/kotlin/org/meshtastic/feature/connections/ui/components/DeviceListItem.kt
@@ -174,20 +174,30 @@ fun DeviceListItem(
/**
* Headline for a device row. When we have a [DeviceListEntry.node] in the local DB (i.e. we've previously connected and
- * learned the device's mesh identity), render the colored [NodeChip] + the node's long name so users can visually
- * identify the device at a glance. Otherwise fall back to the raw advertised device name.
+ * learned the device's mesh identity), render the colored [NodeChip] alongside the node's **long name** so users can
+ * distinguish devices that share a similar short/advertised name (see #5808). Otherwise fall back to the raw advertised
+ * name. The name is allowed to wrap to two lines so long names are legible rather than truncated at a single line.
*/
@Composable
private fun DeviceHeadline(device: DeviceListEntry) {
val node = device.node
if (node != null) {
- NodeChip(node = node)
+ Row(verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy(8.dp)) {
+ NodeChip(node = node)
+ DeviceName(text = node.user.long_name.ifEmpty { device.name }, modifier = Modifier.weight(1f))
+ }
} else {
- Text(
- text = device.name,
- style = MaterialTheme.typography.titleLarge,
- maxLines = 1,
- overflow = TextOverflow.Ellipsis,
- )
+ DeviceName(text = device.name)
}
}
+
+@Composable
+private fun DeviceName(text: String, modifier: Modifier = Modifier) {
+ Text(
+ modifier = modifier,
+ text = text,
+ style = MaterialTheme.typography.titleLarge,
+ maxLines = 2,
+ overflow = TextOverflow.Ellipsis,
+ )
+}

Served by rngit 1.5.2 - Generated in 0.07s